package model.actors;

import model.PokerTP.Table;
import model.messages.*;
import akka.actor.UntypedActor;

public class ActorTable extends UntypedActor {
	private Table table;
	@Override
	public void onReceive(Object message) throws Exception {
		// TODO Automatycznie generowany szkielet metody
		if(message instanceof TableSettings) {
			initTable((TableSettings)message);
		}
		else
			unhandled(message);
	}
	
	public Table getTable() { return table; }
	
	private void initTable(TableSettings settings) {
		if(settings == null) throw new NullPointerException();
		table = new Table(settings.humanPlayers, settings.computerPlayers);
		table.poczatkoweZetony = settings.startTokens;
		table.wpisowe = settings.entranceFee;
	}
}
